package com.atguigu.tingshu.payment.service;

import com.wechat.pay.java.service.refund.model.Refund;
import jakarta.servlet.http.HttpServletRequest;

import java.util.Map;

public interface WxPayService {

    /**
     * 获取小程序拉起微信支付所需参数
     * @param paymentType 支付类型 1301-订单 1302-充值
     * @param orderNo 交易订单号或充值订单号
     * @return {"timeStamp":"","package":"","paySign":"","signType":"RSA","nonceStr":""}
     */
    Map<String, String> createJsapi(Long userId, String paymentType, String orderNo);

    /**
     * 查询订单交易状态
     * @param orderNo
     * @return
     */
    boolean queryPayStatus(String orderNo);

    /**
     * 用户付款成功后，微信支付回调接口
     *
     * @param request
     * @return {code:"SUCCESS",message:"支付成功"}
     */
    Map<String, String> notifyPayResult(HttpServletRequest request);

    /**
     * 微信退款
     * @param orderNo
     */
    Refund refunds(String orderNo);

    /**
     * 关闭微信交易
     * @param orderNo
     */
    public void closeWxPay(String orderNo);
}
